<?php
/** Copyright 2014 TinPhp Systems, Inc.
 * @author zhangxilian 2013-8-20
 * @package TinPhp
 */
/** 统一的站点Session管理类 */
class Auth
{
  public function  __construct()
  {
    session_start();
    parent::__construct();
  }
  /** ----前台用户----*/
  public static function getUserInfo(){
    return $_SESSION['user']['Info'];
  }
  
  public static function setUserInfo($res){
    $_SESSION['user']['Info'] = $res;
  }

  public static function loginOutUser(){
    unset($_SESSION['user']);
    //session_destroy();
  }
  /*--------------------------------------------------------------*/
  /**----后台用户----*/
  public static function getAdminInfo(){
    return $_SESSION['admin']['Info'];
  }
  
  public static function setAdminInfo($res){
    $_SESSION['admin']['Info'] = $res;
  }

  public static function loginOutAdmin(){
    unset($_SESSION['admin']);
    //session_destroy();
  }
  
  public static function getAdminPermission(){
  	return $_SESSION['admin']['permission'];
  }
  public static function setAdminPermission($res){
    $_SESSION['admin']['permission'] = $res;
  }
  /*--------------------------------------------------------------*/
}
?>